<?php
/*
	本插件：$this->model('model')->方法名();
	其他地方调用：model('jy_erp/model')->方法名();
*/
namespace jy_erp;
defined('BY_JYA') or exit('error');
class menus extends \plugin{
	/*
		店长
	*/
	public function juese1_menus(){
		$menus0=array(
			array('title'=>'门店概况','fa'=>'icon-dianpu','url'=>'jy_erp/store.index/','child'=>array(
				array('title'=>'门店概况','child'=>array(
					array('url'=>'jy_erp/store.index/','title'=>'门店概况'),
				)),
			)),
			array('title'=>'直营数据','fa'=>'icon-licaishouyi','url'=>'jy_erp/statistics.goods_days/list/','child'=>array(
				array('title'=>'商品','child'=>array(
					array('url'=>'jy_erp/statistics.goods_days/list/','title'=>'销售统计'),
					array('url'=>'jy_erp/statistics.goods_options/list/','title'=>'规格统计'),
					array('url'=>'jy_erp/statistics.goods/list/','title'=>'销售明细'),
					array('url'=>'jy_erp/statistics.goods_rank/list/','title'=>'销售排行'),
					array('url'=>'jy_erp/statistics.goods_trans/list/','title'=>'销售转化率'),
				)),
				array('title'=>'客户','child'=>array(
					array('url'=>'jy_erp/statistics.member_cost/listd/','title'=>'消费排行'),
					array('url'=>'jy_erp/statistics.member_increase/list/','title'=>'增长趋势'),
				)),
				array('title'=>'业务员','child'=>array(
					array('url'=>'jy_erp/statistics.index/list/','title'=>'数据看板'),
					array('url'=>'jy_erp/statistics.sale/','title'=>'销售统计'),
					array('url'=>'jy_erp/statistics.sale_analysis/list/','title'=>'销售指标'),
					array('url'=>'jy_erp/statistics.order/list/','title'=>'订单统计'),
					array('url'=>'jy_erp/statistics.brand/list/','title'=>'品牌统计'),
				)),
				array('title'=>'财务','child'=>array(
					array('url'=>'jy_erp/finance.data/','title'=>'经营情况'),
					array('url'=>'jy_erp/finance.feedata/','title'=>'利润报表'),
					array('url'=>'jy_erp/finance.in/','title'=>'线上收入'),
					array('url'=>'jy_erp/finance.out/','title'=>'线上支出'),
				)),
			)),
			array('title'=>'商户数据','fa'=>'icon-dianpu','url'=>'jy_erp/statistics.goods_days/mlist/','child'=>array(
				array('title'=>'商品','child'=>array(
					array('url'=>'jy_erp/statistics.goods_days/mlist/','title'=>'销售统计'),
					array('url'=>'jy_erp/statistics.goods_options/mlist/','title'=>'规格统计'),
					array('url'=>'jy_erp/statistics.goods/mlist/','title'=>'销售明细'),
					array('url'=>'jy_erp/statistics.goods_rank/mlist/','title'=>'销售排行'),
					array('url'=>'jy_erp/statistics.goods_trans/mlist/','title'=>'销售转化率'),
				)),
				array('title'=>'业务员','child'=>array(
					array('url'=>'jy_erp/statistics.index/mlist/','title'=>'数据看板'),
					array('url'=>'jy_erp/statistics.msale/','title'=>'销售统计'),
					array('url'=>'jy_erp/statistics.sale_analysis/mlist/','title'=>'销售指标'),
					array('url'=>'jy_erp/statistics.order/mlist/','title'=>'订单统计'),
					array('url'=>'jy_erp/statistics.brand/mlist/','title'=>'品牌统计'),
				)),
				array('title'=>'财务','child'=>array(
					array('url'=>'jy_erp/finance.merchdata/','title'=>'经营情况'),
					array('url'=>'jy_erp/finance.merchfeedata/','title'=>'利润报表'),
					array('url'=>'jy_erp/finance.merch/','title'=>'线上收入'),
					array('url'=>'jy_erp/finance.out/','title'=>'线上支出'),
				)),
			)),
			array('title'=>'销售订单','fa'=>'icon-form','url'=>'jy_erp/order.list2/','child'=>array(
				array('title'=>'其他销售','child'=>array(
					array('url'=>'jy_erp/order.list2/','title'=>'全部订单'),
				)),
			)),
		);
		return $menus0;
	}
	/*
		出纳
	*/
	public function juese14_menus(){
		$menus =$this->juese1_menus();
		$menus[] =array(
			array('title'=>'资金管理','fa'=>'icon-qitashouru','url'=>'jy_erp/caiwu.infee//type=0','child'=>array(
				array('title'=>'往来收支','child'=>array(
					array('url'=>'jy_erp/caiwu.infee//type=0','title'=>'收款单'),
					array('url'=>'jy_erp/caiwu.outfee//type=0','title'=>'付款单'),
					array('url'=>'jy_erp/caiwu.infee//type=1','title'=>'其他收入单'),
					array('url'=>'jy_erp/caiwu.outfee//type=1','title'=>'费用支出单'),
					array('url'=>'jy_erp/caiwu.yinfee/','title'=>'银行存取账单'),
					//array('url'=>'jy_erp/caiwu.infee//type=0','title'=>'应收应付调整单'),
				)),
				array('title'=>'往来核销','child'=>array(
					array('url'=>'jy_erp/caiwu.yufee//type=0','title'=>'预收冲应收单'),
					array('url'=>'jy_erp/caiwu.yufee//type=1','title'=>'预付冲应付单'),
					array('url'=>'jy_erp/caiwu.yuhefee//type=0','title'=>'收款核销执行'),
					array('url'=>'jy_erp/caiwu.yuhefee//type=1','title'=>'付款核销执行'),
				)),
				array('title'=>'现金银行','child'=>array(
					array('url'=>'jy_erp/caiwu.datayin/','title'=>'现金银行统计'),
				)),
				array('title'=>'统计报表','child'=>array(
					array('url'=>'jy_erp/caiwu.datainfee//type=0','title'=>'收款情况统计'),
					array('url'=>'jy_erp/caiwu.dataoutfee//type=0','title'=>'付款情况统计'),
					array('url'=>'jy_erp/caiwu.datainfee//type=1','title'=>'其他收入统计'),
					array('url'=>'jy_erp/caiwu.dataoutfee//type=1','title'=>'费用支出统计'),
					//array('url'=>'jy_erp/caiwu.datayin/','title'=>'超期应收款查询'),
				)),
			)),
		);
		return $menus;
	}
	/*
		会计
	*/
	public function juese17_menus(){
		$menus =$this->juese14_menus();
		return $menus;
	}
	/*
		仓管员
	*/
	public function juese20_menus(){
		$menus =array(
			array('title'=>'采购管理','fa'=>'icon-dingdan','url'=>'jy_erp/caigou.list/edit/','child'=>array(
				array('title'=>'采购业务','child'=>array(
					array('url'=>'jy_erp/caigou.list/edit/','title'=>'采购申请单'),
					array('url'=>'jy_erp/caigou.list/list/','title'=>'采购订单'),
				)),
				array('title'=>'报表','child'=>array(
					array('url'=>'jy_erp/caigou.data/','title'=>'采购申请统计'),
					array('url'=>'jy_erp/caigou.data1/','title'=>'采购订单统计'),
					array('url'=>'jy_erp/caigou.data2/','title'=>'进货单统计'),
				)),
			)),
			array('title'=>'库存核算','fa'=>'icon-zidingyileimu','url'=>'jy_erp/ku.list//type=0','child'=>array(
				array('title'=>'库存管理','child'=>array(
					array('url'=>'jy_erp/ku.goodsku/','title'=>'平台库存'),
					array('url'=>'jy_erp/ku.storeku/','title'=>'门店库存'),
					array('url'=>'jy_erp/ku.list//type=0','title'=>'商品入库单'),
					array('url'=>'jy_erp/ku.list//type=1','title'=>'其他入库单'),
					array('url'=>'jy_erp/ku.chulist//type=0','title'=>'材料出库单'),
					array('url'=>'jy_erp/ku.chulist//type=1','title'=>'其他出库单'),
					array('url'=>'jy_erp/ku.order/list/type=0','title'=>'要货单'),
					array('url'=>'jy_erp/ku.order/diaolist/type=1','title'=>'调拨单'),
					array('url'=>'jy_erp/ku.order/panlist/type=2','title'=>'盘点单'),
				)),
			)),
		);
		return $menus;
	}
	/*
		入库员
	*/
	public function juese21_menus(){
		$menus =$this->juese20_menus();
		return $menus;
	}
	/*
		出库员
	*/
	public function juese22_menus(){
		$menus =$this->juese20_menus();
		return $menus;
	}
	public function getmenus($menus=array(),$juese=0){
		$jueses=pdo_getcolumn('jy_erp_worker',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_SESSION['workerid']),'jueses');
		$jueses=str_array($jueses);
		if($juese!=1 && $juese!=2  && $juese!=15 && $juese!=18){
			$mymenus=$menus;
		}
		foreach($jueses as $wvjuese){
			if($wvjuese!=$juese){
				if($wvjuese==1){
					$menus=$this->juese1_menus();
					if($mymenus[0]){
						$menus[]=$mymenus[0];
					}
				}elseif($wvjuese==4){
					$menus[]=$this->juese3_menus()[0];
				}elseif($wvjuese==5){
					$menus[]=$this->juese5_menus()[0];
				}elseif($wvjuese==6){
					$menus[]=$this->juese6_menus()[0];
				}elseif($wvjuese==7){
					$menus[]=$this->juese7_menus()[0];
				}elseif($wvjuese==8){
					$menus[]=$this->juese8_menus()[0];
				}elseif($wvjuese==13){
					$menus[]=$this->juese13_menus()[0];
				}elseif($wvjuese==14){
					$menus[]=$this->juese14_menus()[0];
				}elseif($wvjuese==17){
					$menus[]=$this->juese17_menus()[0];
				}
			}
		}
		return $menus;
	}
}
?>